<?php

class IndexAction extends PublicAction {
    /**
     * 跳转到首页
     * @author 沈威
     * @tel 15005164276	
     * @email 403382132@qq.com
     * Enter description here ...
     */
	public function index(){
		
		$pictrue_model=D("PictureView");
		$video_model=D("VideoView");
		$flash_model=D("FlashView");
		$game_model=D("GameView");
		$article_model=D("ArticleView");
		$image_model=D("ImageView");
		$book_model=D("BookView");
		$exhibits_model=D("ExhibitsView");
		$knowledge_model=D("KnowledgeView");
		//获取左上角焦点图
		$jiaodianmoedel=M("Jiaodian");
		$jiaodianlist=$jiaodianmoedel->limit(5)->order("id asc")->select();
		$this->assign("jiaodian",$jiaodianlist);
		//获取最新资源
		$dap['status']=1;
		$dap['is_dele']=0;
		$pictrue_list2=$pictrue_model->where($dap)->order("uploadtime desc")->limit("0,1")->find();
		$video_list2=$video_model->where($dap)->order("uploadtime desc")->limit("0,1")->find();
		$flash_list2=$flash_model->where($dap)->order("uploadtime desc")->limit("0,1")->find();
		$game_list2=$game_model->where($dap)->order("uploadtime desc")->limit("0,1")->find();
		$article_list2=$article_model->where($dap)->order("uploadtime desc")->limit("0,1")->find();
		$image_list2=$image_model->where($dap)->order("uploadtime desc")->limit("0,1")->find();
		$book_list2=$book_model->where($dap)->order("uploadtime desc")->limit("0,1")->find();
		$exhibits_list2=$exhibits_model->where($dap)->order("uploadtime desc")->limit("0,1")->find();
		$this->assign("pictrue_list2",$pictrue_list2);
		$this->assign("video_list2",$video_list2);
		$this->assign("flash_list2",$flash_list2);
		$this->assign("game_list2",$game_list2);
		$this->assign("article_list2",$article_list2);
		$this->assign("image_list2",$image_list2);
		$this->assign("book_list2",$book_list2);
		$this->assign("exhibits_list2",$exhibits_list2);
		//获取图片栏目
		$kap['status']=1;
		$kap['is_dele']=0;
		$kap['is_hot']=1;
		$picture_best_point=$pictrue_model->where($kap)->order("point desc")->limit("0,1")->find();
		$pictrue_best_url=explode(',', $picture_best_point['url']);
		$picture_best_point['url']=$pictrue_best_url[0];
		$this->assign("picture_best_point",$picture_best_point);
		$pictrue_list3=$pictrue_model->where($kap)->order("uploadtime desc")->limit("0,4")->select();
		$pictrue_list4=$pictrue_model->where($kap)->order("uploadtime desc")->limit("4,4")->select();
		foreach ($pictrue_list3 as $k1=>$v1)
		{
			$v1_url=explode(',', $v1['url']);
			$pictrue_list3[$k1]['url']=$v1_url[0];
		}
		$this->assign("pictrue_list3",$pictrue_list3);
		foreach ($pictrue_list4 as $k2=>$v2)
		{
			$v2_url=explode(',', $v2['url']);
			$pictrue_list4[$k2]['url']=$v2_url[0];
		}
		$this->assign("pictrue_list4",$pictrue_list4);
		//获取视频栏目
		$video_list3=$video_model->where($kap)->order("uploadtime desc")->limit("0,3")->select();
		$this->assign("video_list3",$video_list3);
		//获取动画栏目
		$flash_list3=$flash_model->where($kap)->order("uploadtime desc")->limit("0,2")->select();
		$this->assign("flash_list3",$flash_list3);
		//获取游戏栏目
		$game_list3=$game_model->where($kap)->order("uploadtime desc")->limit("0,2")->select();
		$this->assign("game_list3",$game_list3);
		//获取挂图栏目
		$image_list3=$image_model->where($kap)->order("uploadtime desc")->limit("0,2")->select();
		foreach ($image_list3 as $k3=>$v3)
		{
			$v3_url=explode(',', $v3['url']);
			$image_list3[$k3]['url']=$v3_url[0];
		}
		$this->assign("image_list3",$image_list3);
		//获取文章栏目
		$article_list3=$article_model->where($kap)->order("uploadtime desc")->limit("0,8")->select();
		$this->assign("article_list3",$article_list3);
		//获取图书栏目 
		$book_list3=$book_model->where($kap)->order("point desc")->limit("0,2")->select();
		$this->assign("book_list3",$book_list3);
		$book_list4=$book_model->where($kap)->order("uploadtime desc")->limit("0,6")->select();
		$this->assign("book_list4",$book_list4);
		//获取展品栏目
		$exhibits_model_m=M('Exhibits');
		$exhibits_list3=$exhibits_model_m->where($kap)->order("uploadtime desc")->limit("0,1")->find();
		$exhibits_list3['desc'] = qucHtml($exhibits_list3['desc']);
		$v4_url=explode(',', $exhibits_list3['url']);
		$exhibits_list3['url']=$v4_url[0];
		$this->assign("exhibits_list3",$exhibits_list3);
		//获取知识题栏目
		$knowledge_list3=$knowledge_model->where($kap)->order("uploadtime desc")->limit("0,8")->select();
		$this->assign("knowledge_list3",$knowledge_list3);
		//获取广告
		$admodel=M('Ad');
		$jap['status']=1;
		$ad=$admodel->where($jap)->limit("0,1")->order("orders desc")->find();
		$this->assign("ad",$ad);
		$this->display();
	}
    
}